
#include <stdint.h>
#include<stdio.h>

unsigned char xor_CHECK ( unsigned char* addr,unsigned int Len )
{

        uint8_t xorval = 0;
	for(int i=1;i<Len-2;i++)
	{
		xorval^=addr[i];
	}
	return xorval;
}

int main() {
    //DD 54 C7 23 13 02 39 39 39 33 37 35 00 00 00 00 00 00 00 00 00 00 00 00 04 00 00 01 00 01 60 02 05 00 00 01 00 02 00 02 01 E0 00 00 00 01 00 00 12 21 00 00 00 34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 15 BB
    uint8_t buff[]={0xDD,0x54,0xC7,0x23,0x13,0x02,0x39,0x39,0x39,0x33,0x37,0x35,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x01,0x00,0x01,0x60,0x02,0x05,0x00,0x00,0x01,0x00,0x02,0x00,0x02,0x01,0xE0,0x00,0x00,0x00,0x01,0x00,0x00,0x12,0x21,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0xBB};
    uint8_t xorval = xor_CHECK(buff, sizeof(buff)-2);
    printf("xorval: 0x%02x\n", xorval);
}